<template>
  <div class="">About</div>
</template>


<script setup lang="ts">
import { IndexedDBHelper } from "../../utils/IndexedDBHelper";

interface User {
  id: number;
  name: string;
  email: string;
}

const dbHelper = new IndexedDBHelper<User>('MyDB', 1);

(async () => {
  await dbHelper.open('users', 'id', [
    { name: 'email', unique: true }
  ]);

  await dbHelper.add('users', { id: 1, name: 'Alice', email: 'alice@example.com' });
  await dbHelper.update('users', { id: 1, name: 'Alice Smith', email: 'alice@example.com' });

  const user = await dbHelper.get('users', 1);
  console.log(user);

  const users = await dbHelper.getAll('users');
  console.log(users);

  await dbHelper.delete('users', 1);

  dbHelper.close();
})();
</script>
